class SubordinatesController < ApplicationController
  
  before_filter :find_superior
  before_filter :superior_required, :only => :add
  
  def index
    @user, @subordinates = @superior, @superior.subordinates unless @superior.nil?
  end
  
  def add
    render :text => 'added as subordinate'
  end
  
  protected
  
  def find_superior
    @superior = User.find_by_id(params[:user_id], :conditions => ['superior = ?', true])
    raise ActiveRecord::RecordNotFound, "Page not found" if @superior.nil?
  end
  
end
